﻿using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;

namespace MyERP.Models
{
    /// <summary>
    /// 采购订单实体类
    /// </summary>
    public class PurchaseOrder
    {
        public string Id { get; set; }
        /// <summary>
        /// 供应商
        /// </summary>
        public string SupplierName { get; set; }
        public DateTime CreateDateTime { get; set; }
        /// <summary>
        /// 物品名称
        /// </summary>
        public string GoodsName { get; set; }
        /// <summary>
        /// 采购数量
        /// </summary>
        public int Amount { get; set; }
        public double Price { get; set; }
        public double Money { get; set; }
        /// <summary>
        /// 单据创建时间
        /// </summary>
        public DateTime DateTimeNow { get; set; } = DateTime.Now;
    }
    public class PurchaseOrderConfig : IEntityTypeConfiguration<PurchaseOrder>
    {
        public void Configure(EntityTypeBuilder<PurchaseOrder> builder)
        {
            builder.ToTable("T_PurchaseOrder");
            builder.Property(e => e.SupplierName).HasMaxLength(20);
            builder.Property(e => e.GoodsName).HasMaxLength(20);
        }
    }
}
